var <?= $this->getSingularName() ?>JSClz = function( options ) {
	
	this.options = options;
	this.taconiteDebug = options.taconiteDebug;
	this.webroot = options.webroot;
	this.container = options.container;
	this.listLinkClass = options.listLinkClass;
	this.newLinkClass = options.newLinkClass;
	this.cancelLinkClass = options.cancelLinkClass;
	this.deleteLinkClass = options.deleteLinkClass;
	this.latesttarget = '';
	var that = this;
	
	this.constructor = function() {
		if( this.taconiteDebug ) {		
			$.taconite.debug = true;
		}
					
			}
	
	this.initList = function() {
		this.constructor();
		this.addListLinks();
		this.addNewListLinks();
	}
	this.initEdit = function() {
		this.constructor();
		this.initForm();
		this.addCancelLink();
		this.addDeleteLink();
	}
	
	this.initForm = function() {
		$('#' + this.container + ' form').ajaxForm( function() {
		});
	}
	this.addListLinks = function() {
		$(this.listLinkClass).each(function(idx, obj){ 
			$(obj).click(function(e){ 
				$.ajax( {method: "GET", url: that.webroot + '/<?= $this->getModuleName() ?>/' + $(e.target).text() + '/edit'} ); 
				return false; 
			});
		});
	}
	this.addNewListLinks = function() {
		$('.' + this.newLinkClass).each(function(idx, obj){ 
			$(obj).click(function(e){ 
				$.ajax( {method: "GET", url: that.webroot + '/<?= $this->getModuleName() ?>/new'} );
				return false;
			});
		});
	}
	this.addCancelLink = function() {
		$('.' + this.cancelLinkClass).each(function(idx, obj){ 
			$(obj).click(function(e){ 
				$.ajax( {method: "GET", url: that.webroot + '/<?= $this->getModuleName() ?>'} );
				return false;
			});
		});
	}
	this.addDeleteLink = function() {
		$('.' + this.deleteLinkClass).each(function(idx, obj){ 
			$(obj).click(function(e){ 
				if( confirm('are you sure?') ) {
					$.ajax( {method: "GET", url: that.webroot + '/<?= $this->getModuleName() ?>/' + that.latesttarget.attr('alt') + '/delete'} );
					return false;
				}
				else {
					return false;
				}
			});
		});
	}
}
